package jiang.jredis.starter;

import jiang.jredis.lock.RedisLockAspect;
import jiang.jredis.starter.annotation.EnableLocking;
import org.redisson.api.RedissonClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Redis锁相关配置
 */
@Configuration
@ConditionalOnBean(annotation = EnableLocking.class)
public class RedisLockAutoConfiguration {

    /**
     * Redis锁AOP
     */
    @Bean
    public RedisLockAspect redisLockAspect(RedissonClient redissonClient) {
        return new RedisLockAspect(redissonClient);
    }

}
